
let action = 'Hi';
class Person {

    constructor(name,age) {
        this.name = name;
        this.age = age;
        this[action] = '666';
    }

    ['say'+ action]() {
        console.log(`${action} form ${this.name}`);
    }
}

let p1 = new Person('daxia',18);
console.log(p1);
p1.sayHi()